{% extends "template/listEdit.volt" %}

{% block title %}监控飞机管理{% endblock %}


{% block filter %}
    <div class="col-md-4 col-sm-6">
        <table>
            <tr>
                <th>飞机序列号:</th>
                <td><input type="text" name="uas_serial_id" value=""></td>
            </tr>
            <tr>
                <th>证书类型:</th>
                <td><select name="cert_type">
                        <option value="">请选择</option>
                        <option value="1">混合证书</option>
                        <option value="0">无限期</option>
                    </select></td>
            </tr>
            <tr>
                <th></th>
                <td></td>
            </tr>
        </table>
    </div>
    <div class="col-md-4 col-sm-6">
        <table>
            <tr>
                <th>飞机型号:</th>
                <td><select name="plane_type_id">
                        <option value="">请选择</option>
                        {% for id,name in planeTypeList %}
                            <option value="{{ id }}">{{ name }}</option>
                        {% endfor %}
                    </select></td>
            </tr>
            <tr>
                <th>到期时限:</th>
                <td><input type="date-h" name="expired_at_start" data-attr="date" value="">-<input type="date-h"
                                                                                                   name="expired_at_end"
                                                                                                   data-attr="date right"
                                                                                                   value=""></td>
            </tr>
            <tr>
                <th></th>
                <td></td>
            </tr>
        </table>
    </div>
    <div class="col-md-4 col-sm-6">
        <table>
            <tr>
                <th>手机号码:</th>
                <td><input type="text" name="phone" value=""></td>
            </tr>
            <tr>
                <th>钥匙ID:</th>
                <td><input type="text" name="key_id" value=""></td>
            </tr>
            <tr>
                <td colspan="2">
                    <div id="btn_reset_param" class="btn-0 button">清 空</div>
                    <div id="btn_search_data" class="btn-1 button">过 滤</div>
                </td>
            </tr>
        </table>
    </div>
{% endblock %}
{% block hiddenDeleteAll %}hidden{% endblock %}

{% block jscontent %}
    <script>
        var isSubadminSystem ={{ isSubAdmin }};
        function actionDetail(tag) {
            window.location.href = "/subsystem/monitorDetail?userid=" + tag;
        }
        function actionDelete(tag) {
            FConfirm("您确定移除掉该飞机吗?", function (result) {
                if (result) {
                    $.post("/subsystem/doDeleteUser", {
                        "user_id": tag
                    }, function (result) {
                        FAlert(result.message);
                        PageDataProxy.refresh();
                    });
                }
            });
        }

        function clickDetail(result) {

            PageDataProxy.actionDetail(result);

            //window.location.href="/plane/detail?"+result;
        }

        $(function () {

            PageDataProxy.init({
                "action_detail_url": "/plane/detail",
                "url": "/subsystem/monitorList4Plane",
                "table_id": "#mytable",
                "page_control_id": "#data-wrap",
                "page_size_id": "#rows-perpage-select",
                "page_total_id": "#data_count_total",
                "use_check_box": false,
                "data_field_process": function (name, value) {
                    if (name == "company") {
                        return PageDataProxy.formatShortContent(value, 18);
                    }
                    if (name == "id") {
                        return "<a href='javascript:void(0)' onclick=PageDataProxy.actionDetail('id=" + value + "')>" + value + "</a>";
                        ;
                    }
                    return value;
                },
                "table_style": {
                    "id": "width-s",
                    "uas_serial_id": "width-m",
                    "nickname": "width-m",
                    "planeModel_id": "width-m",
                    "phone": "width-m",
                    "name": "width-m",
                    "company": "width-m",
                    "created_at": "width-m"
                },
                "data_field_action_process": function (tag) {
                    var str = "<td onclick=clickDetail('id=" + tag + "')><img class='action-show-icon'>详细</td>";
                    if (isSubadminSystem) {
                        str += "<td onclick=PageDataProxy.actionDelete('plane_id','" + tag + "','您确定移除飞机?')><img class='action-del-icon'>移除</td>";
                    }
                    return str;
                },
            });

            DataAttrBinder.init();
        });


    </script>
{% endblock %}
